import { defineStore } from "pinia";
import { ref } from 'vue'
import { getOrderListAPI } from "@/apis/order";
import { ElMessage } from 'element-plus'
export const useOrderStore = defineStore('order', () => {
    //用户订单列表，属性{订单编号，订单状态，支付倒计时，支付金额，收货地址}
    const orderList = ref([])
    const getOrderList = async (id, state) => {

        const res = await getOrderListAPI(id, state)
        orderList.value = res.orderList;
    }


    return {
        orderList,
        getOrderList
    }
}, {
    persist: true
})